package com.blb.service.impl;

import com.blb.entity.Company;
import com.blb.entity.Staff;
import com.blb.entity.User;
import com.blb.mapper.AccountMapper;
import com.blb.service.IAccountService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class AccountServiceImpl implements IAccountService {

    @Resource
    private AccountMapper accountMapper;

    /**
     * 企业账号管理分页和模糊查询
     * @param start
     * @param length
     * @param legal
     * @param companyName
     * @param companyStatus
     * @param creatTime
     * @param creatTime1
     * @return
     */
    @Override
    public List<Company> getCompanys(int start,int length, String legal, String companyName, String companyStatus, String creatTime, String creatTime1) {
        return accountMapper.getCompanys(start, length, legal, companyName, companyStatus, creatTime, creatTime1);
    }
    /**
     * 根据条件查询企业条数
     * @param legal
     * @param companyName
     * @param companyStatus
     * @param creatTime
     * @param creatTime1
     * @return
     */
    @Override
    public int count(String legal, String companyName, String companyStatus, String creatTime, String creatTime1) {
        return accountMapper.count(legal, companyName, companyStatus, creatTime, creatTime1);
    }
    /**
     * 根据企业id实现员工的分页和模糊查询
     * @param id
     * @param start
     * @param length
     * @param name
     * @param accountStatus
     * @param entryTime
     * @param entryTime1
     * @return
     */
    @Override
    public List<User> getStaffs(String id, int start, int length, String name, String accountStatus, String entryTime, String entryTime1) {
        return accountMapper.getStaffs(id,start, length, name, accountStatus, entryTime, entryTime1);
    }

    /**
     * 根据企业id和条件查询企业条数
     * @param id
     * @param name
     * @param accountStatus
     * @param entryTime
     * @param entryTime1
     * @return
     */
    @Override
    public int count1(String id, String name, String accountStatus, String entryTime, String entryTime1) {
        return accountMapper.count1(id,name, accountStatus, entryTime, entryTime1);
    }
    /**
     * 通过员工id查找公司和员工信息
     * @param id
     * @return
     */
    @Override
    public User getCompayAndStaff(String id) {
        return accountMapper.getCompayAndStaff(id);
    }
    /**
     * 修改企业账号状态
     * @param id
     * @param status
     */
    @Override
    public void updateStatus(String id, String status) {
        accountMapper.updateStatus(id, status);
    }
    /**
     * 批量修改企业账号状态
     * @param ids
     */
    @Override
    public void updateAllStatus(String[] ids) {
        accountMapper.updateAllStatus(ids);
    }
}
